package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TabChatMsg;
import com.ruoyi.system.mapper.TabChatMsgMapper;
import com.ruoyi.system.service.ITabChatMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * wx消息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-12
 */
@Service
public class TabChatMsgServiceImpl implements ITabChatMsgService {
    @Autowired
    private TabChatMsgMapper tabChatMsgMapper;

    /**
     * 查询wx消息
     *
     * @param id wx消息主键
     * @return wx消息
     */
    @Override
    public TabChatMsg selectTabChatMsgById(Long id) {
        return tabChatMsgMapper.selectTabChatMsgById(id);
    }

    /**
     * 查询wx消息列表
     *
     * @param tabChatMsg wx消息
     * @return wx消息
     */
    @Override
    public List<TabChatMsg> selectTabChatMsgList(TabChatMsg tabChatMsg) {
        return tabChatMsgMapper.selectTabChatMsgList(tabChatMsg);
    }

    /**
     * 新增wx消息
     *
     * @param tabChatMsg wx消息
     * @return 结果
     */
    @Override
    public int insertTabChatMsg(TabChatMsg tabChatMsg) {
        tabChatMsg.setCreateTime(DateUtils.getNowDate());
        return tabChatMsgMapper.insertTabChatMsg(tabChatMsg);
    }

    /**
     * 修改wx消息
     *
     * @param tabChatMsg wx消息
     * @return 结果
     */
    @Override
    public int updateTabChatMsg(TabChatMsg tabChatMsg) {
        return tabChatMsgMapper.updateTabChatMsg(tabChatMsg);
    }

    /**
     * 批量删除wx消息
     *
     * @param ids 需要删除的wx消息主键
     * @return 结果
     */
    @Override
    public int deleteTabChatMsgByIds(String ids) {
        return tabChatMsgMapper.deleteTabChatMsgByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除wx消息信息
     *
     * @param id wx消息主键
     * @return 结果
     */
    @Override
    public int deleteTabChatMsgById(Long id) {
        return tabChatMsgMapper.deleteTabChatMsgById(id);
    }
}
